package org.dromara.study.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.dromara.common.core.domain.R;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.study.domain.bo.EmployeeBo;
import org.dromara.study.domain.entity.Skill;
import org.dromara.study.domain.vo.EmployeeVo;
import org.dromara.study.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/employee")
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;

    @PostMapping("/add")
    public R<String> add(@RequestBody EmployeeBo employeeBo) {
        employeeService.saveAll(employeeBo);
        return R.ok("新增成功");
    }

    @GetMapping("/list")
    public R<Page<EmployeeVo>> list(PageQuery pageQuery, EmployeeVo employeeVo) {
        return R.ok(employeeService.getList(pageQuery, employeeVo));
    }


}
